package com.farewell.blog.service.impl;

import com.farewell.blog.entity.QueryBean;
import com.farewell.blog.mapper.ResourceMapper;
import com.farewell.blog.pojo.Resource;
import com.farewell.blog.service.ResourceService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Farewell
 * @date 2021/3/4
 */
@Service
public class ResourceServiceImpl implements ResourceService {
    @Autowired
    private ResourceMapper resourceMapper;

    @Override
    public List<Resource> getAllResource() {
        return resourceMapper.getAllResources();
    }

    @Override
    public void addResource(Resource resource) {
        resourceMapper.insert(resource);
    }

    @Override
    public void updateResource(Resource resource) {
        resourceMapper.updateAllColumnById(resource);
    }

    @Override
    public void deleteResource(Long id) {
        resourceMapper.deleteById(id);
    }
}
